<#include "/default/utils/ui.ftl"/>

<#assign title = view.title + ' - ' + site_name />
<#assign keywords = view.tags + '' +view.keywords?default(site_keywords) />
<#assign description = view.tags + '' +view.description?default(site_description) />

<@layout title keywords description>
<div class="row main">
    <div class="col-xs-12 col-md-9 side-left topics-show">
        <div class="topic panel panel-default" style="text-align: center;margin-bottom:20px;">
            <a id="change_sender" href="###" style="cursor:pointer;">
                <img src="/static/default/images/change.gif" style="width:100%;height:100%" border="0"/>
            </a>
        </div>
        <#--<div class="topic panel panel-default" style="text-align: center;margin-bottom:10px;">-->
            <#--<script type="text/javascript">var jd_union_unid="2714",jd_ad_ids="1455:6",jd_union_pid="CKe7w//MLBCaFRoAINXoqpkFKgA=";var jd_width=739;var jd_height=164;var jd_union_euid="";var p="AhAPURlaEwUTAmVEH0hfIlgRRgYlXVZaCCsfSlpMWGVEH0hfIlQGGhoTBUBPNkgfXX12VD1NGX5yaFFZF2sVABsOURxYFAQWN1YdWxAyIlgRRgYlSXwGZUQfSF8iB1EZWBAKFAZWHF4TACIGZStr";</script><script type="text/javascript" charset="utf-8" src="//u-x.jd.com/static/js/auto.js"></script>-->
        <#--</div>-->
        <!-- view show -->
        <div class="topic panel panel-default">
            <div class="infos panel-heading">

                <h1 class="panel-title topic-title">${view.title}</h1>
                <div class="meta inline-block">

                    <a class="author" href="${base}/users/${view.author.id}">
                    ${view.author.name}
                    </a>
                    <abbr class="timeago">${timeAgo(view.created)}</abbr>
                    ⋅
                ${view.views} 阅读
                    ⋅
                数据来源【${view.fromSite}】
                <!--tag 标签-->
                <#--<div class="panel-footer operate">-->
                <input type="hidden" id="tagTitle" value="${view.tags}"/>
                <#list view.tagsArray as tag>
                    <span>
                        <a class="label label-default" href="${base}/tag/${tag}/">#${tag}</a>
                    </span>
                </#list>
                <#--</div>-->

                </div>

                <div class="clearfix"></div>
            </div>

            <#if plist??>
                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                    <!-- Indicators -->
                    <ol class="carousel-indicators" style="background-color:#7f7f7f;width:100%;left:0px;margin-left:0px;height:30px;bottom:-40px;">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active" style="margin-top:9px;"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1" style="margin-top:9px;"></li>
                    </ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner" role="listbox">
                        <#if plist??>
                            <#list plist as pdata>
                                <#if pdata_index ==0>
                                    <div class="item active">
                                        <#if view.fromSite=="百姓网">
                                            <img src="${(pdata)!}" alt="...">
                                        <#else>
                                            <img src="http://pbl71lr73.bkt.clouddn.com/${(pdata)!}?imageView2/1/w/846/h/359" alt="...">
                                        </#if>
                                    </div>
                                <#else>
                                    <div class="item">
                                        <#if view.fromSite=="百姓网">
                                            <img src="${(pdata)!}" alt="...">
                                        <#else>
                                            <img src="http://pbl71lr73.bkt.clouddn.com/${(pdata)!}?imageView2/1/w/846/h/359" alt="...">
                                        </#if>
                                    </div>
                                </#if>
                            </#list>
                        </#if>
                    </div>
                </div>
            </#if>


            <div class="content-body entry-content panel-body" style="padding-top:30px;">
                <div class="markdown-body">
                ${view.content}
                </div>
            </div>

            <div class="panel-footer operate">
                <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
                <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
            </div>

            <!--div class="panel-footer operate">
                <div class="hidden-xs">
                    <div class="social-share" data-sites="weibo, wechat, facebook, twitter, google, qzone, qq"></div>
                </div>
                <div class="clearfix"></div>
            </div-->
        </div>
        <div class="topic panel panel-default" style="text-align: center;">
            <a id="banner_sender" href="###" style="cursor:pointer;">
                <img src="/static/default/images/banner.jpg" style="width:100%;height:100%" border="0"/>
            </a>
        </div>
        <!-- Comments -->
        <div id="chat" class="chats shadow-box">
            <div class="chat_other">
                <h4>全部评论: <i id="chat_count">0</i> 条</h4>
            </div>
            <ul id="chat_container" class="its"></ul>
            <div id="pager" class="text-center"></div>
            <div class="cbox-wrap">
                <div class="cbox-title">我有话说: <span id="chat_reply" style="display:none;">@<i
                        id="chat_to"></i></span>
                </div>
                <div class="cbox-post">
                    <div class="cbox-input">
                        <textarea id="chat_text" rows="3" placeholder="请输入评论内容"></textarea>
                        <input type="hidden" value="0" name="chat_pid" id="chat_pid"/>
                    </div>
                    <div class="cbox-ats clearfix">
                        <div class="ats-func">
                            <ul class="func-list">
                                <li class="list-b">
                                    <a href="javascript:void(0);" class="join" id="c-btn"><i
                                            class="fa fa-smile-o fa-2"></i></a>
                                </li>
                            </ul>
                        </div>
                        <div class="ats-issue">
                            <button id="btn-chat" class="btn btn-success btn-sm bt">发送</button>
                        </div>
                    </div>
                </div>
                <div class="phiz-box" id="c-phiz" style="display:none">
                    <div class="phiz-list" view="c-phizs"></div>
                </div>
            </div>
        </div>
        <!-- /view show -->
    </div>
    <div class="col-xs-12 col-md-3 side-right hidden-xs hidden-sm">
        <ul class="list-group about-user">
            <li class="list-group-item user-card" >
                <div class="ava">
                    <a href="${base}/users/${view.author.id}">
                        <@showAva view.author.avatar "img-circle"/>
                    </a>
                </div>
                <div class="user-info">
                    <div class="nk mb10">${view.author.name}</div>
                    <div class="mb6">
                        <a class="btn btn-default btn-xs" href="javascript:void(0);" data-id="${view.author.id}" rel="follow"><i class="icon icon-user-follow"></i> 关注</a>
                    </div>
                </div>
            </li>
            <li class="list-group-item">
                <div class="user-datas">
                    <ul>
                        <li><strong>${view.author.posts}</strong><span>发布</span></li>
                        <li class="noborder"><strong>${view.author.comments}</strong><span>评论</span></li>
                    </ul>
                </div>
            </li>
            <li class="list-group-item">
                <div class="text-center padding-md">
                    <a class="btn btn-default btn-sm" href="javascript:void(0);" data-id="${view.id}" rel="favor">
                        <i class="icon icon-like"></i> 喜欢
                    </a>
                    <strong id="favors">${view.favors}</strong> 喜欢
                </div>
            </li>
            <#--<li class="list-group-item">-->
                <#--<div class="text-center padding-md">-->
                    <#--<button id="buy_click" type="button" class="btn btn-success btn-lg">-->
                        <#--<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>喜欢就去联系对方->-->
                    <#--</button>-->
                <#--</div>-->
            <#--</li>-->
        </ul>
        <#if view.fromSite=="百姓网">
            <div class="panel panel-default corner-radius panel-hot-topics">
                <div class="panel-heading text-center">
                    <a href="${view.clickUrl}" target="_" style="color:red;">
                        <h3 class="panel-title"><i class="fa fa-arrow-right"></i>联系商家<i class="fa fa-arrow-left"></i></h3>
                    </a>
                </div>
            </div>
        </#if>
        <div class="panel panel-default corner-radius panel-hot-topics">
            <div class="panel-heading text-center">
                <h3 class="panel-title"><i class="fa fa-bars"></i>相关信息</h3>
            </div>
            <div class="panel-body">
                <ul class="list" id="releaseId">
                    <img src="${base}/dist/images/spinner.gif">
                </ul>
            </div>
        </div>
        <#include "/default/inc/right.ftl"/>
    </div>
</div>

<script type="text/plain" id="chat_template">
    <li id="chat{5}">
        <a class="avt fl" target="_blank" href="${base}/users/{0}">
            <img src="${base}{1}">
        </a>
        <div class="chat_body">
            <h5>
                <div class="fl"><a class="chat_name" href="${base}/users/{0}">{2}</a><span>{3}</span></div>
                <div class="fr reply_this"><a href="javascript:void(0);" onclick="goto('{5}', '{2}')">[回复]</a></div>
                <div class="clear"></div>
            </h5>
            <div class="chat_p">
                <div class="chat_pct">{4}</div> {6}
            </div>
        </div>
        <div class="clear"></div>
        <div class="chat_reply"></div>
    </li>
</script>

<script type="text/javascript">
    function goto(pid, user) {
        document.getElementById('chat_text').scrollIntoView();
        $('#chat_text').focus();
        $('#chat_text').val('');
        $('#chat_to').text(user);
        $('#chat_pid').val(pid);

        $('#chat_reply').show();
    }
    var container = $("#chat_container");
    var template = $('#chat_template')[0].text;

    seajs.use('comment', function (comment) {
        comment.init({
            load_url: '${base}/comment/list/${view.id}',
            post_url: '${base}/comment/submit',
            toId: '${view.id}',
            onLoad: function (i, data) {

                var content = ContentRender.wrapItem(data.content);

                var quoto = '';
                if (data.pid > 0 && !(data.parent === null)) {
                    var pat = data.parent;
                    var pcontent = ContentRender.wrapItem(pat.content);
                    quoto = '<div class="quote"><a href="${base}/users/' + pat.author.id + '">@' + pat.author.name + '</a>: ' + pcontent + '</div>';
                }
                var item = jQuery.format(template,
                        data.author.id,
                        data.author.avatar,
                        data.author.name,
                        data.created,
                        content,
                        data.id, quoto);
                return item;
            }
        });
    });

    seajs.use(['phiz', 'view'], function (phiz) {
        $("#c-btn").jphiz({
            base: '${base}/dist',
            textId: 'chat_text',
            lnkBoxId: 'c-lnk',
            phizBoxId: 'c-phiz'
        });
    });

</script>
<script src="/static/default/js/modules/change.js"></script>
</@layout>
